package com.skyward.android.androiddemo2.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by skyward on 2017/3/15.
 * email:
 */

public class CircleTimeLineView extends View {

    private int mMeasuredWidth;
    private int mMeasuredHeight;

    public CircleTimeLineView(Context context) {
        super(context);
    }

    public CircleTimeLineView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CircleTimeLineView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        mMeasuredWidth = getMeasuredWidth();
        mMeasuredHeight = getMeasuredHeight();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setColor(Color.RED);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(1);
        paint.setAntiAlias(true);
        canvas.drawCircle(mMeasuredWidth/2,mMeasuredHeight/2,mMeasuredWidth/2,paint);
    }
}
